import 'package:flutter/material.dart';
import 'package:untitled1/app/widgets/toast/MyToast.dart';

import '../../../res/myColors.dart';
import '../../../utils/utilScreen.dart';
import '../../../widgets/TitleBar.dart';
import '../../../widgets/base_page/BaseStatefulPage.dart';

//家员服务记录
class ServerRecordPage extends BaseStatefulPage {
  @override
  BaseStatefulPageState<BaseStatefulPage> createState() {
    return _ServerRecordPageState();
  }

}

class _ServerRecordPageState extends BaseStatefulPageState<ServerRecordPage> {
  @override
  Widget buildPage(BuildContext context) {
    return Scaffold(
      appBar: TitleBar(title: "服务记录"),
      body: Container(
        width: utilScreen.getScreenWidth(context),
        height: utilScreen.getScreenHeight(context),
        decoration: BoxDecoration(
          color: Colors.white,
          // borderRadius: BorderRadius.only(
          //   topLeft: Radius.circular(5),
          //   topRight: Radius.circular(5),
          // ),
        ),
        child:    Stack(
          children: [
            Column(
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                SizedBox(height: 10,),

                Expanded(child: ListView.separated(
                    itemBuilder: (context,index){
                      return buildItem();
                    },
                    separatorBuilder: ( context,  index){
                      return SizedBox(height: 10,);
                    },
                    itemCount: 10)
                ),
              ],
            ),
            // Align(
            //   alignment: Alignment.centerRight,
            //   child: GestureDetector(
            //     onTap: () => Navigator.of(context).pop(),
            //     child: CircleAvatar(
            //       radius: 14,
            //       backgroundColor: Colors.grey[300],
            //       child: Icon(Icons.close, size: 18, color: Colors.black),
            //     ),
            //   ),
            // ),
          ],
        ),




      ),
    );
  }
  Widget buildItem(){
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        buildItemContent( 'xxx'),
        buildItemContent2('xxx','查看合同'),
        buildItemContent('xxx'),
      ],
    );
  }
  Widget buildItemContent( String title) {
    return Container(
      margin: EdgeInsets.only(left: 15, right: 15, top: 5),
      child: Text(
        '${title}',
        style: TextStyle(fontSize: 14, color: myColors.c_707070),
      ),
    );
  }
  Widget buildItemContent2(String title, String content) {
    return InkWell(
        onTap: () {
          MyToast.showSystemToast("查看合同");
        },
        child: Container(
          margin: EdgeInsets.only(left: 15, right: 15, top: 5),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                '${title}',
                style: TextStyle(fontSize: 14, color: myColors.c_707070),
              ),
              Text(
                '${content}',
                style: TextStyle(fontSize: 14, color: myColors.c_707070),
              )
            ],
          ),
        )
    );
  }
}